<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" media="screen" href="../../css/bootstrap.min.css">
</head>
<style>
    label {
        text-align: right;
    }

</style>
<body>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
    <form class="form-horizontal" onsubmit="return false" id="form">
        <fieldset>
            <input type="hidden" id="id" name="id">

            <div class='form-group'>
                <label class='col-md-2 '>真实姓名</label>
                <div class='col-md-10'>
                    <span id="realname" style="padding-top: 17px; "></span>
                </div>
            </div>
            <div class='form-group'>
                <label class='col-md-2 '>执业证号</label>
                <div class='col-md-10'>
                    <span id="workCode"></span>
                </div>
            </div>
            <div class='form-group'>
                <label class='col-md-2 '>执业证图片</label>
                <div class='col-md-10'>
                    <span id="workBootImage"></span>
                </div>
            </div>
            <div class='form-group'>
                <label class='col-md-2 '>所在地区</label>
                <div class='col-md-10'>
                    <span id="areaName"></span>
                </div>
            </div>
            <div class='form-group'>
                <label class='col-md-2 '>地区编号</label>
                <div class='col-md-10'>
                    <span id="comid"></span>
                </div>
            </div>
            <div class='form-group'>
                <label class='col-md-2 '>律师事务所名称</label>
                <div class='col-md-10'>
                    <span id="lawfirm"></span>
                </div>
            </div>

            <div class='form-group'>
                <label class='col-md-2 '>律师编号</label>
                <div class='col-md-10'>
                    <span id="licensenumber"></span>
                </div>
            </div>

            <div class='form-group'>
                <label class='col-md-2 '>身份证号</label>
                <div class='col-md-10'>
                    <span id="idnumber"></span>
                </div>
            </div>
            <div class='form-group'>
                <label class='col-md-2 '>身份证号正反面</label>
                <div class='col-md-10'>
                    <span id="idnumberImage"></span>
                </div>
            </div>
            <div class='form-group'>
                <label class='col-md-2 '>擅长领域</label>
                <div class='col-md-10'>
                    <span id="field"></span>
                </div>
            </div>
            <div class='form-group'>
                <label class='col-md-2 '>律师寄语</label>
                <div class='col-md-10'>
                    <span id="content"></span>
                </div>
            </div>
            <div class='form-group'>
                <label class='col-md-2 '>教育背景</label>
                <div class='col-md-10'>
                    <span id="education"></span>
                </div>
            </div>
            <div class='form-group'>
                <label class='col-md-2 '>认证资质</label>
                <div class='col-md-10'>
                    <span id="thirdlevel"></span>
                </div>
            </div>

            <div class='form-group'>
                <label class='col-md-2 '>申请时间</label>
                <div class='col-md-10'>
                    <span id="createTime"></span>
                </div>
            </div>


            <div class="form-actions">
                <div class="row" align="center">
                    <div class="col-md-12">
                        <button class="btn btn-primary" onclick="location.href='lawyerAuditList.html'">返回</button>
                        &nbsp;&nbsp;&nbsp;&nbsp;
                        <button class="btn btn-primary" type="submit" onclick="refuse()">
                            <i class="fa fa-save"></i> 拒绝
                        </button>
                        &nbsp;&nbsp;&nbsp;&nbsp;
                        <button class="btn btn-primary" type="submit" onclick="pass()">
                            <i class="fa fa-save"></i> 通过
                        </button>
                    </div>
                </div>
            </div>

        </fieldset>
    </form>
</div>
<script type="text/javascript" src="../../js/libs/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="../../js/jq.js"></script>
<script type="text/javascript" src="../../js/plugin/bootstrapvalidator/bootstrapValidator.min.js"></script>
<script type="text/javascript" src="../../js/common.js"></script>
<script type="text/javascript" src="../../layui/layui.js"></script>
<script type="text/javascript" src="../../js/my/permission.js"></script>
<script type="text/javascript">
    layui.use(['layer', 'laydate'], function () {
        var layer = layui.layer;
    });
    var example;


    function isEmpty(obj){
        if(typeof obj == "undefined" || obj == null || obj == ""){
            return true;
        }else{
            return false;
        }
    }


    initData();

    function initData() {
        var id = getUrlParam("id");
        if (id != "") {
            $.ajax({
                type: 'get',
                url: '/lawyerAudit/' + id,
                async: false,
                success: function (data) {
                    $('#id').val(data.id);
                    $('#userid').html(data.userid);
                    $('#realname').html(data.realname);
                    $('#workCode').html(data.workCode);
                    $('#areaName').html(data.areaName);
                    $('#comid').html(data.comid);
                    $('#lawfirm').html(data.lawfirm);
                    $('#licensenumber').html(data.licensenumber);


                    if (!isEmpty(data.workBootImage)) {
                        var workBootImageGroup = data.workBootImage.split(";");
                        var workBootImage = '';
                        for (var i = 0; i < workBootImageGroup.length; i++) {
                            workBootImage += '<a href="/statics' + workBootImageGroup[i] + '" target="_blank"><img src="/statics' + workBootImageGroup[i] + '"    height="120" width="120" ></a>&nbsp;&nbsp;&nbsp;&nbsp;';
                        }
                        $('#workBootImage').html(workBootImage);
                    }
                    $('#idnumber').html(data.idnumber);
                    if (!isEmpty(data.idnumberImage)) {
                        var idnumberImageGroup = data.idnumberImage.split(";");
                        var idnumberImage = '';
                        for (var i = 0; i < idnumberImageGroup.length; i++) {
                            idnumberImage += '<a href="/statics' + idnumberImageGroup[i] + '" target="_blank"><img src="/statics' + idnumberImageGroup[i] + '"  height="120" width="120" ></a>&nbsp;&nbsp;&nbsp;&nbsp;';
                        }
                        $('#idnumberImage').html(idnumberImage);
                    }

                    $('#field').html(data.field);
                    $('#content').html(data.content);
                    $('#education').html(data.education);
                    $('#thirdlevel').html(data.thirdlevel);
                    $('#createTime').html(data.createTime);

                }
            });
        }
    }


    function pass() {
        var id = $("#id").val();

        layer.confirm('确定通过该律师审核吗？', {
            btn: ['确定', '取消']
        }, function () {
            $.ajax({
                type: 'post',
                url: '/lawyerAudit/audit',
                data: {
                    "id": id,"type" : 1
                },
                success: function (data) {
                    if (data.errCode == 200) {
                        layer.msg("已审核通过", {shift: -1, time: 1000}, function() {
                            location.href = "lawyerAuditList.html";
                        });
                    } else {
                        layer.msg(data.message, {shift: -1, time: 1000}, function() {
                            location.href = "lawyerAuditList.html";
                        });
                    }
                }
            });

            layer.close(1);
        });
    }

    function refuse() {
        var id = $("#id").val();

        layer.confirm('确定拒绝该律师审核吗？', {
            btn: ['确定', '取消']
        }, function () {
            $.ajax({
                type: 'post',
                url: '/lawyerAudit/audit',
                data: {
                    "id": id,"type" : 3
                },
                success: function (data) {
                    if (data.errCode == 200) {
                        layer.msg("已拒绝", {shift: -1, time: 1000}, function() {
                            location.href = "lawyerAuditList.html";
                        });
                    } else {
                        layer.msg(data.message, {shift: -1, time: 1000}, function() {
                            location.href = "lawyerAuditList.html";
                        });
                    }

                }
            });

            layer.close(1);
        });
    }

</script>
</body>
</html>
